Skip to content

Feature: workspace info app extension#18014

Merged
nielslyngsoe merged 24 commits intov15/devfrom
v15/feature/workspace-info-app-extension
Jan 31, 2025
Merged

Feature: workspace info app extension#18014
nielslyngsoe merged 24 commits intov15/devfrom
v15/feature/workspace-info-app-extension

Conversation

@madsrasmussen
Copy link
Copy Markdown
Member

@madsrasmussen madsrasmussen commented Jan 17, 2025

This PR introduces a new extension point called "workspaceInfoApp," allowing the addition of new apps to the info workspace view. It also turns the links-, references-, and audit log-boxes for documents and media into extensions.

Fixes #16687

Screenshot 2025-01-31 at 09 15 12

</body>`;

popup.document.open();
popup.document.write(html);

Check failure

Code scanning / CodeQL

Client-side cross-site scripting

Cross-site scripting vulnerability due to [user-provided value](1).

Copilot Autofix

AI about 1 year ago

To fix the cross-site scripting vulnerability, we need to ensure that the window.location.href value is properly sanitized or encoded before it is used in the html string. The best way to do this is to use a library that provides functions for escaping HTML content.

In this case, we can use the DOMPurify library to sanitize the window.location.href value. This library is well-known and widely used for preventing cross-site scripting attacks.

  1. Install the DOMPurify library.
  2. Import the DOMPurify library in the file.
  3. Use DOMPurify.sanitize to sanitize the window.location.href value before including it in the html string.
Suggested changeset 1
src/Umbraco.Web.UI.Client/src/packages/media/media/url/info-app/media-links-workspace-info-app.element.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/url/info-app/media-links-workspace-info-app.element.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/url/info-app/media-links-workspace-info-app.element.ts
--- a/src/Umbraco.Web.UI.Client/src/packages/media/media/url/info-app/media-links-workspace-info-app.element.ts
+++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/url/info-app/media-links-workspace-info-app.element.ts
@@ -4,2 +4,3 @@
 import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
+import DOMPurify from 'dompurify';
 
@@ -46,3 +47,3 @@
 	<img src="${imagePath}"/>
-	<script>history.pushState(null, null, "${window.location.href}");</script>
+	<script>history.pushState(null, null, "${DOMPurify.sanitize(window.location.href)}");</script>
 </body>`;
EOF
@@ -4,2 +4,3 @@
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import DOMPurify from 'dompurify';

@@ -46,3 +47,3 @@
<img src="${imagePath}"/>
<script>history.pushState(null, null, "${window.location.href}");</script>
<script>history.pushState(null, null, "${DOMPurify.sanitize(window.location.href)}");</script>
</body>`;
Copilot is powered by AI and may make mistakes. Always verify output.
@madsrasmussen madsrasmussen marked this pull request as ready for review January 31, 2025 08:13
@madsrasmussen madsrasmussen added the category/dx Developer experience label Jan 31, 2025
@nielslyngsoe nielslyngsoe merged commit 30c4408 into v15/dev Jan 31, 2025
@nielslyngsoe nielslyngsoe deleted the v15/feature/workspace-info-app-extension branch January 31, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants